/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * AdministarUsuarios.java
 *
 * Created on Oct 22, 2009, 4:57:44 PM
 */

package scapi.gui;
import java.rmi.RemoteException;
import java.sql.SQLException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.*;
import javax.swing.table.DefaultTableModel;
import scapi.entidades.Direccion;
import scapi.entidades.Usuario;
import scapi.servidor.servidores.ServidorAUsuario;
import scapi.utilerias.EValidacion;
import scapi.utilerias.ExcepcionValidacion;
import scapi.utilerias.ModeloDatosUsuarios;
import scapi.utilerias.ServidorFactory;

/**
 *
 * @author jair roa 
 */
public class AdministarUsuarios extends javax.swing.JFrame {

    // Variables declaration
    private ServidorAUsuario servUsu,servUsuNextId,datUsu;
    String pass,nombrePersona,apPaterno,apMaterno,email,rfc,calle,colonia,delegacion,estado,pais,nomUsu,tipo,elimUsu;
    int lada,telefono,numInt,numExt,codPos,nextUsu,nextId,sigId,valSig,index,camId;
    String arreDatUsu[][],nuevoArre[][],datReg[][];
    Date fecha;
    char sexo;
    Usuario usuario;
    java.util.Date fecha5;
    Direccion direccionUsu;
    //declaro mi mdelo de datos
    ModeloDatosUsuarios modeloUsu;
 
    public AdministarUsuarios() {
        this.setTitle("Administar Usuarios");
        initComponents();


        BotModifUsu.setEnabled(false);

        try{
            datUsu = (ServidorAUsuario) ServidorFactory.obtenerServidor(ServidorFactory.ServidorUsuario);
            arreDatUsu = datUsu.consultaGeneral();
        }catch(Exception e){
        e.printStackTrace();
        }

        TablaUsuarios.setModel(new DefaultTableModel(arreDatUsu,
        new String [] {"IdUsu","IdSuc","NomUsu","xxx","TipUsu"}
                ));

        this.setLocationRelativeTo(null);
        try {
            modeloUsu = new ModeloDatosUsuarios();
        } catch (RemoteException ex) {
            Logger.getLogger(AdministarUsuarios.class.getName()).log(Level.SEVERE, null, ex);
        } catch (SQLException ex) {
            Logger.getLogger(AdministarUsuarios.class.getName()).log(Level.SEVERE, null, ex);
        }

        try{
            servUsu = (ServidorAUsuario) ServidorFactory.obtenerServidor(ServidorFactory.ServidorUsuario);
            servUsuNextId = (ServidorAUsuario) ServidorFactory.obtenerServidor(ServidorFactory.ServidorUsuario);
            
            //obtener id siguiente
            System.out.println(nextId = servUsuNextId.ultimoUsuario()+1);
            //agragando id siguiente
            System.out.println(arreDatUsu[0][3]);
            String masUno = nextId+"";
            
            textId.setText(masUno);
        }catch(Exception e){
           e.printStackTrace();
        }
        
       
    }

    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        PanelDatPer = new javax.swing.JPanel();
        labNombre = new javax.swing.JLabel();
        labFechaNac = new javax.swing.JLabel();
        labSexo = new javax.swing.JLabel();
        RadButFem = new javax.swing.JRadioButton();
        RadButtMas = new javax.swing.JRadioButton();
        labTelefono = new javax.swing.JLabel();
        txtNombre = new javax.swing.JTextField();
        txtLada = new javax.swing.JTextField();
        PanelDireccion = new javax.swing.JPanel();
        labCalle = new javax.swing.JLabel();
        labNoExt = new javax.swing.JLabel();
        lanNoInt = new javax.swing.JLabel();
        labColonia = new javax.swing.JLabel();
        labCodigoPos = new javax.swing.JLabel();
        labDelegacion = new javax.swing.JLabel();
        labEstado = new javax.swing.JLabel();
        labPais = new javax.swing.JLabel();
        txtCalle = new javax.swing.JTextField();
        txtNumExt = new javax.swing.JTextField();
        txtNumInt = new javax.swing.JTextField();
        txtColonia = new javax.swing.JTextField();
        txtCodPostal = new javax.swing.JTextField();
        txtDelegacion = new javax.swing.JTextField();
        txtEstado = new javax.swing.JTextField();
        txtPais = new javax.swing.JTextField();
        labMail = new javax.swing.JLabel();
        labRFC = new javax.swing.JLabel();
        txtEmail = new javax.swing.JTextField();
        txtRfc = new javax.swing.JTextField();
        FecNac = new com.toedter.calendar.JDateChooser();
        txtTelefono = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        txtApPaterno = new javax.swing.JTextField();
        txtApMaterno = new javax.swing.JTextField();
        PanelDatUsu = new javax.swing.JPanel();
        labID = new javax.swing.JLabel();
        labNomUsu = new javax.swing.JLabel();
        labPassword = new javax.swing.JLabel();
        labTipUsu = new javax.swing.JLabel();
        textId = new javax.swing.JTextField();
        txtNomUsu = new javax.swing.JTextField();
        comboTipo = new javax.swing.JComboBox();
        txtPassword = new javax.swing.JPasswordField();
        botRegisUsu = new javax.swing.JButton();
        BotCancRegis = new javax.swing.JButton();
        PanelUsuarios = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        TablaUsuarios = new javax.swing.JTable(modeloUsu);
        labTipUsuarios = new javax.swing.JLabel();
        bottFiltar = new javax.swing.JButton();
        BotElimUsu = new javax.swing.JButton();
        BotModifUsu = new javax.swing.JButton();
        botConsulInf = new javax.swing.JButton();
        ComboFiltro = new javax.swing.JComboBox();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setResizable(false);

        PanelDatPer.setBorder(javax.swing.BorderFactory.createTitledBorder(null, " Datos Personales ", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Chiller", 0, 24), new java.awt.Color(0, 0, 255))); // NOI18N

        labNombre.setText("Nombre :");

        labFechaNac.setText("Fecha Nacimiento :");

        labSexo.setText("Sexo :");

        buttonGroup1.add(RadButFem);
        RadButFem.setSelected(true);
        RadButFem.setText("Femenino");
        RadButFem.setName("femenino"); // NOI18N

        buttonGroup1.add(RadButtMas);
        RadButtMas.setText("Masculino");
        RadButtMas.setName("masculino"); // NOI18N

        labTelefono.setText("Telefono :");

        txtNombre.setName("txtNombre");

        PanelDireccion.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Direccion", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Chiller", 0, 24), new java.awt.Color(0, 0, 255))); // NOI18N

        labCalle.setText("Calle :");

        labNoExt.setText("Numero Ext :");

        lanNoInt.setText("Numero Int :");

        labColonia.setText("Colonia :");

        labCodigoPos.setText("Codigo Postal :");

        labDelegacion.setText("Delegacion :");

        labEstado.setText("Estado :");

        labPais.setText("Pais :");

        javax.swing.GroupLayout PanelDireccionLayout = new javax.swing.GroupLayout(PanelDireccion);
        PanelDireccion.setLayout(PanelDireccionLayout);
        PanelDireccionLayout.setHorizontalGroup(
            PanelDireccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelDireccionLayout.createSequentialGroup()
                .addGroup(PanelDireccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(PanelDireccionLayout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(PanelDireccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(labPais)
                            .addComponent(labEstado)
                            .addComponent(labDelegacion)
                            .addComponent(labCodigoPos)
                            .addComponent(labColonia)
                            .addComponent(lanNoInt))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(PanelDireccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtColonia, javax.swing.GroupLayout.DEFAULT_SIZE, 225, Short.MAX_VALUE)
                            .addComponent(txtNumInt, javax.swing.GroupLayout.DEFAULT_SIZE, 225, Short.MAX_VALUE)
                            .addComponent(txtCodPostal, javax.swing.GroupLayout.DEFAULT_SIZE, 225, Short.MAX_VALUE)
                            .addComponent(txtEstado, javax.swing.GroupLayout.DEFAULT_SIZE, 225, Short.MAX_VALUE)
                            .addComponent(txtPais, javax.swing.GroupLayout.DEFAULT_SIZE, 225, Short.MAX_VALUE)
                            .addComponent(txtDelegacion, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 225, Short.MAX_VALUE)))
                    .addGroup(PanelDireccionLayout.createSequentialGroup()
                        .addGroup(PanelDireccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(PanelDireccionLayout.createSequentialGroup()
                                .addGap(52, 52, 52)
                                .addComponent(labCalle))
                            .addGroup(PanelDireccionLayout.createSequentialGroup()
                                .addGap(19, 19, 19)
                                .addComponent(labNoExt)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(PanelDireccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(txtNumExt, javax.swing.GroupLayout.DEFAULT_SIZE, 219, Short.MAX_VALUE)
                            .addComponent(txtCalle, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 219, Short.MAX_VALUE))))
                .addContainerGap())
        );
        PanelDireccionLayout.setVerticalGroup(
            PanelDireccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelDireccionLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PanelDireccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtCalle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(labCalle))
                .addGap(9, 9, 9)
                .addGroup(PanelDireccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtNumExt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(labNoExt))
                .addGap(9, 9, 9)
                .addGroup(PanelDireccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtNumInt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lanNoInt))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PanelDireccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labColonia)
                    .addComponent(txtColonia, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PanelDireccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labCodigoPos)
                    .addComponent(txtCodPostal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PanelDireccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labDelegacion)
                    .addComponent(txtDelegacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PanelDireccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labEstado)
                    .addComponent(txtEstado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PanelDireccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labPais)
                    .addComponent(txtPais, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(42, Short.MAX_VALUE))
        );

        labMail.setText("E-mail :");

        labRFC.setText("RFC :");

        jLabel1.setText("Apellidos:");

        javax.swing.GroupLayout PanelDatPerLayout = new javax.swing.GroupLayout(PanelDatPer);
        PanelDatPer.setLayout(PanelDatPerLayout);
        PanelDatPerLayout.setHorizontalGroup(
            PanelDatPerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelDatPerLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PanelDatPerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(PanelDireccion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(PanelDatPerLayout.createSequentialGroup()
                        .addComponent(labFechaNac)
                        .addGroup(PanelDatPerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(PanelDatPerLayout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(FecNac, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, PanelDatPerLayout.createSequentialGroup()
                                .addGap(90, 90, 90)
                                .addComponent(RadButtMas))))
                    .addGroup(PanelDatPerLayout.createSequentialGroup()
                        .addComponent(labSexo)
                        .addGap(18, 18, 18)
                        .addComponent(RadButFem))
                    .addGroup(PanelDatPerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, PanelDatPerLayout.createSequentialGroup()
                            .addGroup(PanelDatPerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jLabel1)
                                .addComponent(labNombre))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(PanelDatPerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addGroup(PanelDatPerLayout.createSequentialGroup()
                                    .addComponent(txtApPaterno, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(txtApMaterno, javax.swing.GroupLayout.PREFERRED_SIZE, 159, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addComponent(txtNombre)))
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, PanelDatPerLayout.createSequentialGroup()
                            .addGroup(PanelDatPerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(labTelefono)
                                .addComponent(labMail))
                            .addGap(4, 4, 4)
                            .addGroup(PanelDatPerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PanelDatPerLayout.createSequentialGroup()
                                    .addComponent(txtLada, javax.swing.GroupLayout.DEFAULT_SIZE, 58, Short.MAX_VALUE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(txtTelefono, javax.swing.GroupLayout.PREFERRED_SIZE, 233, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addComponent(txtRfc, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 297, Short.MAX_VALUE)
                                .addComponent(txtEmail, javax.swing.GroupLayout.DEFAULT_SIZE, 297, Short.MAX_VALUE))))
                    .addComponent(labRFC))
                .addContainerGap(21, Short.MAX_VALUE))
        );
        PanelDatPerLayout.setVerticalGroup(
            PanelDatPerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelDatPerLayout.createSequentialGroup()
                .addGroup(PanelDatPerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labNombre)
                    .addComponent(txtNombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PanelDatPerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(txtApPaterno, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtApMaterno, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(11, 11, 11)
                .addGroup(PanelDatPerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(labFechaNac)
                    .addComponent(FecNac, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PanelDatPerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labSexo)
                    .addComponent(RadButFem)
                    .addComponent(RadButtMas))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PanelDatPerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labTelefono)
                    .addComponent(txtLada, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtTelefono, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PanelDatPerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labMail)
                    .addComponent(txtEmail, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PanelDatPerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labRFC)
                    .addComponent(txtRfc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(PanelDireccion, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        PanelDatUsu.setBorder(javax.swing.BorderFactory.createTitledBorder(null, " Datos De Usuario ", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Chiller", 0, 24), new java.awt.Color(0, 0, 255))); // NOI18N

        labID.setText("Id :");

        labNomUsu.setText("Nom Usuario :");

        labPassword.setText("Password :");

        labTipUsu.setText("Tipo Usuario :");

        textId.setEnabled(false);

        comboTipo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Valuador", "Registrador", "Cajero" }));

        txtPassword.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtPasswordActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout PanelDatUsuLayout = new javax.swing.GroupLayout(PanelDatUsu);
        PanelDatUsu.setLayout(PanelDatUsuLayout);
        PanelDatUsuLayout.setHorizontalGroup(
            PanelDatUsuLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelDatUsuLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PanelDatUsuLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(PanelDatUsuLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(labPassword)
                        .addComponent(labID)
                        .addComponent(labNomUsu))
                    .addComponent(labTipUsu))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PanelDatUsuLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(txtPassword)
                    .addComponent(txtNomUsu)
                    .addComponent(comboTipo, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(textId, javax.swing.GroupLayout.DEFAULT_SIZE, 267, Short.MAX_VALUE))
                .addContainerGap(88, Short.MAX_VALUE))
        );
        PanelDatUsuLayout.setVerticalGroup(
            PanelDatUsuLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelDatUsuLayout.createSequentialGroup()
                .addGroup(PanelDatUsuLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labID)
                    .addComponent(textId, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PanelDatUsuLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labNomUsu)
                    .addComponent(txtNomUsu, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PanelDatUsuLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labPassword)
                    .addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PanelDatUsuLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labTipUsu)
                    .addComponent(comboTipo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(20, Short.MAX_VALUE))
        );

        botRegisUsu.setText("Registrar Usuario");
        botRegisUsu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botRegisUsuActionPerformed(evt);
            }
        });

        BotCancRegis.setText("Reiniciar");
        BotCancRegis.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotCancRegisActionPerformed(evt);
            }
        });

        PanelUsuarios.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Usuarios", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Chiller", 0, 24), new java.awt.Color(0, 0, 255))); // NOI18N

        /*
        */
        jScrollPane1.setViewportView(TablaUsuarios);

        labTipUsuarios.setText("Tipo de Usuario:");

        bottFiltar.setText("Filtar");
        bottFiltar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bottFiltarActionPerformed(evt);
            }
        });

        BotElimUsu.setText("Eliminar Usuario");
        BotElimUsu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotElimUsuActionPerformed(evt);
            }
        });

        BotModifUsu.setText("Guardar Cambios");
        BotModifUsu.setAutoscrolls(true);
        BotModifUsu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotModifUsuActionPerformed(evt);
            }
        });

        botConsulInf.setText("Inf. Personal Usu.");
        botConsulInf.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botConsulInfActionPerformed(evt);
            }
        });

        ComboFiltro.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Todos", "Registrador", "Valuador", "Cajero" }));
        ComboFiltro.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ComboFiltroActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout PanelUsuariosLayout = new javax.swing.GroupLayout(PanelUsuarios);
        PanelUsuarios.setLayout(PanelUsuariosLayout);
        PanelUsuariosLayout.setHorizontalGroup(
            PanelUsuariosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelUsuariosLayout.createSequentialGroup()
                .addGap(35, 35, 35)
                .addComponent(BotElimUsu)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 54, Short.MAX_VALUE)
                .addComponent(botConsulInf)
                .addGap(39, 39, 39)
                .addComponent(BotModifUsu)
                .addGap(26, 26, 26))
            .addGroup(PanelUsuariosLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(labTipUsuarios)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(ComboFiltro, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(30, 30, 30)
                .addComponent(bottFiltar)
                .addContainerGap(159, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PanelUsuariosLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 475, Short.MAX_VALUE)
                .addContainerGap())
        );
        PanelUsuariosLayout.setVerticalGroup(
            PanelUsuariosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelUsuariosLayout.createSequentialGroup()
                .addGroup(PanelUsuariosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labTipUsuarios)
                    .addComponent(ComboFiltro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(bottFiltar))
                .addGap(18, 18, 18)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 157, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(32, 32, 32)
                .addGroup(PanelUsuariosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(BotElimUsu)
                    .addComponent(BotModifUsu)
                    .addComponent(botConsulInf))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(PanelDatPer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(86, 86, 86)
                        .addComponent(botRegisUsu)
                        .addGap(58, 58, 58)
                        .addComponent(BotCancRegis))
                    .addComponent(PanelDatUsu, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(PanelUsuarios, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(PanelDatPer, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(PanelDatUsu, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(24, 24, 24)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(botRegisUsu)
                            .addComponent(BotCancRegis))
                        .addGap(18, 18, 18)
                        .addComponent(PanelUsuarios, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents
// metodo para eliminar a los usuarios desde la tabla
    private void botRegisUsuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botRegisUsuActionPerformed
        try {
           //Crea Objeto Usuario heredado de Persona
            nombrePersona = EValidacion.cadenaCorrecta(txtNombre.getText(), "Nombre");
            apPaterno = EValidacion.cadenaCorrecta(txtApPaterno.getText(),"Apellido Paterno");
            apMaterno = EValidacion.cadenaCorrecta(txtApMaterno.getText(),"Apellido Materno");

            String f = FecNac.getDate().toString();
            //fecha =  EValidacion.cadenaCorrecta(f, "Fecha");
                    //EValidacion.fecha(FecNac.getDate());
               if(this.RadButFem.isSelected())
                      sexo = 'm';
                    else
                      sexo = 'h';
            lada = EValidacion.LADA(txtLada.getText(),"Lada");
            telefono = EValidacion.telefono(txtTelefono.getText(),"Telefono");
            email = EValidacion.email(txtEmail.getText(),"E-mail");
            rfc = EValidacion.RFC(txtRfc.getText(),"RFC");
           

            //Crea objeto Direccion
            calle = EValidacion.cadenaCorrecta(txtCalle.getText(), "calle");
            numInt = EValidacion.numeroCorrecto(txtNumInt.getText(),"Numero Interior");
            numExt = EValidacion.numeroCorrecto(txtNumExt.getText(),"Numero Exterior");
            colonia = EValidacion.cadenaCorrecta(txtColonia.getText(),"Colonia");
            codPos = EValidacion.numeroCorrecto(txtCodPostal.getText(),"Codigo Postal");
            delegacion = EValidacion.cadenaCorrecta(txtDelegacion.getText(),"Delegacion");
            estado = EValidacion.cadenaCorrecta(txtEstado.getText(),"Delegacion");
            pais = EValidacion.cadenaCorrecta(txtPais.getText(),"Pais");

            //Datos Usuario
            nomUsu = EValidacion.cadenaCorrecta(txtNomUsu.getText(),"Nombre de Usuario");
            pass = EValidacion.campoVacio(new String(txtPassword.getPassword()),"Password");
            tipo = (String) comboTipo.getSelectedItem();

            //Objeto Direccion
            direccionUsu = new Direccion(calle, ""+numInt, numExt, colonia, codPos, delegacion, estado, pais);

            //Objeto Usuario
            usuario= new Usuario(0, nombrePersona, apPaterno, apMaterno, fecha, sexo, lada, telefono, direccionUsu, email, rfc, nomUsu, pass, tipo);
            try {
                //Aqui damos de alta el usuario
                servUsu.altaUsuario(1, usuario);
            } catch (RemoteException ex) {
                Logger.getLogger(AdministarUsuarios.class.getName()).log(Level.SEVERE, null, ex);
            } catch (SQLException ex) {
                Logger.getLogger(AdministarUsuarios.class.getName()).log(Level.SEVERE, null, ex);
            }
            //mensaje

            JOptionPane.showMessageDialog(null,"Alta exitosa");

            try{
                TablaUsuarios.setModel(new ModeloDatosUsuarios(datUsu.consultaGeneral()));
           
            }catch(Exception e){
             e.printStackTrace();
            }modeloUsu.fireTableDataChanged();

            try {
                sigId = servUsuNextId.ultimoUsuario()+1;
            } catch (RemoteException ex) {
                Logger.getLogger(AdministarUsuarios.class.getName()).log(Level.SEVERE, null, ex);
            } catch (SQLException ex) {
                Logger.getLogger(AdministarUsuarios.class.getName()).log(Level.SEVERE, null, ex);
            }

           textId.setText(sigId+"");
           txtApMaterno.setText("");
           txtApPaterno.setText("");
           txtCalle.setText("");
           txtCodPostal.setText("");
           txtColonia.setText("");
           txtDelegacion.setText("");
           txtEmail.setText("");
           txtEstado.setText("");
           txtLada.setText("");
           txtNomUsu.setText("");
           txtNombre.setText("");
           txtNumExt.setText("");
           txtNumInt.setText("");
           txtPais.setText("");
           txtPassword.setText("");
           txtRfc.setText("");
           txtTelefono.setText("");
           FecNac.setDate(null);

           //TablaUsuarios.setModel(modeloUsu);
             }catch (ExcepcionValidacion e) {
             JOptionPane.showMessageDialog(this,e.getMessage(), "ERROR", JOptionPane.ERROR_MESSAGE);
             }


    }//GEN-LAST:event_botRegisUsuActionPerformed

    private void BotCancRegisActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotCancRegisActionPerformed
       int respond = JOptionPane.showConfirmDialog(this, "¿Seguro que desea Reiniciar?", "Alerta",JOptionPane.YES_NO_OPTION, JOptionPane.CANCEL_OPTION);
       BotModifUsu.setEnabled(false);
        try {
            sigId = servUsuNextId.ultimoUsuario() + 1;
        } catch (RemoteException ex) {
            Logger.getLogger(AdministarUsuarios.class.getName()).log(Level.SEVERE, null, ex);
        } catch (SQLException ex) {
            Logger.getLogger(AdministarUsuarios.class.getName()).log(Level.SEVERE, null, ex);
        }

       if(respond==JOptionPane.YES_OPTION)
       {
           textId.setText(sigId+"");
           txtApMaterno.setText("");
           txtApPaterno.setText("");
           txtCalle.setText("");
           txtCodPostal.setText("");
           txtColonia.setText("");
           txtDelegacion.setText("");
           txtEmail.setText("");
           txtEstado.setText("");
           txtLada.setText("");
           txtNomUsu.setText("");
           txtNombre.setText("");
           txtNumExt.setText("");
           txtNumInt.setText("");
           txtPais.setText("");
           txtPassword.setText("");
           txtRfc.setText("");
           txtTelefono.setText("");
           FecNac.setDate(null);

           textId.setEnabled(false);
           txtApMaterno.setEnabled(true);
           txtApPaterno.setEnabled(true);
           txtCalle.setEnabled(true);
           txtCodPostal.setEnabled(true);
           txtColonia.setEnabled(true);
           txtDelegacion.setEnabled(true);
           txtEmail.setEnabled(true);
           txtEstado.setEnabled(true);
           txtLada.setEnabled(true);
           txtNomUsu.setEnabled(true);
           txtNombre.setEnabled(true);
           txtNumExt.setEnabled(true);
           txtNumInt.setEnabled(true);
           txtPais.setEnabled(true);
           txtPassword.setEnabled(true);
           txtRfc.setEnabled(true);
           txtTelefono.setEnabled(true);
           FecNac.setEnabled(true);
         }
       
    }//GEN-LAST:event_BotCancRegisActionPerformed

    private void txtPasswordActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtPasswordActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtPasswordActionPerformed

    private void BotElimUsuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotElimUsuActionPerformed
        //int selectOption = JOptionPane.showConfirmDialog(null,"Quiere continuar con el proceso");
        try{
           elimUsu = (String) TablaUsuarios.getValueAt(TablaUsuarios.getSelectedRow(), 0);
           int opc = JOptionPane.showConfirmDialog(null, "Quiere continuar con el proceso");
           if(opc == 0){
               datUsu.bajaUsuario(elimUsu);
               TablaUsuarios.setModel(new ModeloDatosUsuarios(datUsu.consultaGeneral()));
           }
      }catch(Exception e){
          JOptionPane.showMessageDialog(null, "Debe Seleccionar un registro");
        }modeloUsu.fireTableDataChanged();
        try {
            sigId = servUsuNextId.ultimoUsuario() + 1;
        } catch (RemoteException ex) {
            Logger.getLogger(AdministarUsuarios.class.getName()).log(Level.SEVERE, null, ex);
        } catch (SQLException ex) {
            Logger.getLogger(AdministarUsuarios.class.getName()).log(Level.SEVERE, null, ex);
        }
          textId.setText(sigId+"");
    }//GEN-LAST:event_BotElimUsuActionPerformed

    private void BotModifUsuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotModifUsuActionPerformed
            try {
           //Crea Objeto Usuario heredado de Persona
           try{
           elimUsu = (String) TablaUsuarios.getValueAt(TablaUsuarios.getSelectedRow(), 0);
           }catch(Exception e){
              JOptionPane.showMessageDialog(null, "Debe seleccionar un usuario");
           }
           camId = Integer.parseInt(elimUsu);
            nombrePersona = EValidacion.cadenaCorrecta(txtNombre.getText(), "Nombre");
            apPaterno = EValidacion.cadenaCorrecta(txtApPaterno.getText(),"Apellido Paterno");
            apMaterno = EValidacion.cadenaCorrecta(txtApMaterno.getText(),"Apellido Materno");
            fecha = EValidacion.fecha(FecNac.getDate());
               if(this.RadButFem.isSelected())
                      sexo = 'm';
                    else
                      sexo = 'h';
            lada = EValidacion.LADA(txtLada.getText(),"Lada");
            telefono = EValidacion.telefono(txtTelefono.getText(),"Telefono");
            email = EValidacion.email(txtEmail.getText(),"E-mail");
            rfc = EValidacion.RFC(txtRfc.getText(),"RFC");


            //Crea objeto Direccion
            calle = EValidacion.cadenaCorrecta(txtCalle.getText(), "calle");
            numInt = EValidacion.numeroCorrecto(txtNumInt.getText(),"Numero Interior");
            numExt = EValidacion.numeroCorrecto(txtNumExt.getText(),"Numero Exterior");
            colonia = EValidacion.cadenaCorrecta(txtColonia.getText(),"Colonia");
            codPos = EValidacion.numeroCorrecto(txtCodPostal.getText(),"Codigo Postal");
            delegacion = EValidacion.cadenaCorrecta(txtDelegacion.getText(),"Delegacion");
            estado = EValidacion.cadenaCorrecta(txtEstado.getText(),"Delegacion");
            pais = EValidacion.cadenaCorrecta(txtPais.getText(),"Pais");

            //Datos Usuario
            nomUsu = EValidacion.cadenaCorrecta(txtNomUsu.getText(),"Nombre de Usuario");
            pass = EValidacion.campoVacio(new String(txtPassword.getPassword()),"Password");
            tipo = (String) comboTipo.getSelectedItem();

            //System.out.println(nomUsu);

            //Objeto Direccion
            direccionUsu = new Direccion(calle, ""+numInt, numExt, colonia, codPos, delegacion, estado, pais);

            //Objeto Usuario
            usuario= new Usuario(0, nombrePersona, apPaterno, apMaterno, fecha, sexo, lada, telefono, direccionUsu, email, rfc, nomUsu, pass, tipo);
            try {
                //Aqui damos de alta el usuario
                servUsu.cambioUsuario(camId, usuario,1);
            } catch (RemoteException ex) {
                Logger.getLogger(AdministarUsuarios.class.getName()).log(Level.SEVERE, null, ex);
            } catch (SQLException ex) {
                JOptionPane.showMessageDialog(null, "El nombre de usuario ya existe");
            }
            //mensaje

            //JOptionPane.showMessageDialog(null,"Los Cambios Fueron Guardados");

            try{
                TablaUsuarios.setModel(new ModeloDatosUsuarios(datUsu.consultaGeneral()));
                //JOptionPane.showMessageDialog(null,"Los Cambios Fueron Guardados");
                 //System.out.println(datUsu.consultaGeneral()[0][2]);
            }catch(Exception e){
             e.printStackTrace();
            }modeloUsu.fireTableDataChanged();

            try {
                sigId = servUsuNextId.ultimoUsuario()+1;
                //JOptionPane.showMessageDialog(null,"Los Cambios Fueron Guardados");
            } catch (RemoteException ex) {
                Logger.getLogger(AdministarUsuarios.class.getName()).log(Level.SEVERE, null, ex);
            } catch (SQLException ex) {
                Logger.getLogger(AdministarUsuarios.class.getName()).log(Level.SEVERE, null, ex);
            }

           textId.setText(sigId+"");
           txtApMaterno.setText("");
           txtApPaterno.setText("");
           txtCalle.setText("");
           txtCodPostal.setText("");
           txtColonia.setText("");
           txtDelegacion.setText("");
           txtEmail.setText("");
           txtEstado.setText("");
           txtLada.setText("");
           txtNomUsu.setText("");
           txtNombre.setText("");
           txtNumExt.setText("");
           txtNumInt.setText("");
           txtPais.setText("");
           txtPassword.setText("");
           txtRfc.setText("");
           txtTelefono.setText("");
           FecNac.setDate(null);

           BotModifUsu.setEnabled(false);
             }catch (ExcepcionValidacion e) {
             JOptionPane.showMessageDialog(this,e.getMessage(), "ERROR", JOptionPane.ERROR_MESSAGE);
             }

        
    }//GEN-LAST:event_BotModifUsuActionPerformed

    private void botConsulInfActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botConsulInfActionPerformed
        try{
        elimUsu = (String) TablaUsuarios.getValueAt(TablaUsuarios.getSelectedRow(), 0);
        BotModifUsu.setEnabled(true);
       //System.out.println(elimUsu);
        usuario = datUsu.consultaUsuario(elimUsu+"");

           textId.setText(usuario.getId()+"");
           txtApMaterno.setText(usuario.getApMaterno());
           txtApPaterno.setText(usuario.getApPaterno());

           direccionUsu = new Direccion();
           direccionUsu = usuario.getDireccion();

           txtCalle.setText(direccionUsu.getCalle());
           txtCodPostal.setText(direccionUsu.getCodPostal()+"");
           txtColonia.setText(direccionUsu.getColonia());
           txtDelegacion.setText(direccionUsu.getDelegacion());
           txtEmail.setText(usuario.getEmail());
           txtEstado.setText(direccionUsu.getEstado());
           txtLada.setText(usuario.getLada()+"");
           txtNomUsu.setText(usuario.getNomUsuario());
           txtNombre.setText(usuario.getNombre());
           txtNumExt.setText(direccionUsu.getNumExt()+"");
           txtNumInt.setText(direccionUsu.getNumInt());
           txtPais.setText(direccionUsu.getPais());
           txtPassword.setText(usuario.getPassword());
           txtRfc.setText(usuario.getRfc());
           txtTelefono.setText(usuario.getTelefono()+"");

           String fec = usuario.getFechaNac();
           System.out.println(fec);

           SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
           Date fech = sdf.parse(fec);

           //FecNac.setCalendar(fech);
           //System.out.println(fech.getDate());

           FecNac.setDate(fech);

          // String f = usuario.getFechaNac();
           //System.out.println(f);
           //buttonGroup1.set


           if(usuario.getTipo().equals("Valuador")){
               index = 0;
           }

           if(usuario.getTipo().equals("Registrador")){
              index = 1;
           }

           if(usuario.getTipo().equals("Cajero")){
              index = 2;
           }

           comboTipo.setSelectedIndex(index);
           comboTipo.setEnabled(false);
           FecNac.setDate(null);

           //campos desabilitados

           textId.setEnabled(false);
           comboTipo.setEnabled(true);
           txtApMaterno.setEnabled(true);
           txtApPaterno.setEnabled(true);
           txtCalle.setEnabled(true);
           txtCodPostal.setEnabled(true);
           txtColonia.setEnabled(true);
           txtDelegacion.setEnabled(true);
           txtEmail.setEnabled(true);
           txtEstado.setEnabled(true);
           txtLada.setEnabled(true);
           txtNomUsu.setEnabled(true);
           txtNombre.setEnabled(true);
           txtNumExt.setEnabled(true);
           txtNumInt.setEnabled(true);
           txtPais.setEnabled(true);
           txtPassword.setEnabled(true);
           txtRfc.setEnabled(true);
           txtTelefono.setEnabled(true);
           FecNac.setEnabled(true);

       }catch(Exception e){
        JOptionPane.showMessageDialog(null, "Debe Seleccionar un registro");
        }
    }//GEN-LAST:event_botConsulInfActionPerformed

    private void bottFiltarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bottFiltarActionPerformed

}//GEN-LAST:event_bottFiltarActionPerformed

    private void ComboFiltroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ComboFiltroActionPerformed
        //ComboFiltro.getSelectedIndex();
        int selecInd = ComboFiltro.getSelectedIndex();

        if(selecInd==0){
            //System.out.println("1");
            //datUsu.consultaFiltrada();
        }
        if(selecInd==1){

            //System.out.println(datReg[0][1]);
        }
        if(selecInd==2){
            //System.out.println("3");
        }
        if(selecInd==3){
            //System.out.println("4");
        }
}//GEN-LAST:event_ComboFiltroActionPerformed

      
      

  public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
               
                    new AdministarUsuarios().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton BotCancRegis;
    private javax.swing.JButton BotElimUsu;
    private javax.swing.JButton BotModifUsu;
    private javax.swing.JComboBox ComboFiltro;
    private com.toedter.calendar.JDateChooser FecNac;
    private javax.swing.JPanel PanelDatPer;
    private javax.swing.JPanel PanelDatUsu;
    private javax.swing.JPanel PanelDireccion;
    private javax.swing.JPanel PanelUsuarios;
    private javax.swing.JRadioButton RadButFem;
    private javax.swing.JRadioButton RadButtMas;
    private javax.swing.JTable TablaUsuarios;
    private javax.swing.JButton botConsulInf;
    private javax.swing.JButton botRegisUsu;
    private javax.swing.JButton bottFiltar;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JComboBox comboTipo;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JLabel labCalle;
    private javax.swing.JLabel labCodigoPos;
    private javax.swing.JLabel labColonia;
    private javax.swing.JLabel labDelegacion;
    private javax.swing.JLabel labEstado;
    private javax.swing.JLabel labFechaNac;
    private javax.swing.JLabel labID;
    private javax.swing.JLabel labMail;
    private javax.swing.JLabel labNoExt;
    private javax.swing.JLabel labNomUsu;
    private javax.swing.JLabel labNombre;
    private javax.swing.JLabel labPais;
    private javax.swing.JLabel labPassword;
    private javax.swing.JLabel labRFC;
    private javax.swing.JLabel labSexo;
    private javax.swing.JLabel labTelefono;
    private javax.swing.JLabel labTipUsu;
    private javax.swing.JLabel labTipUsuarios;
    private javax.swing.JLabel lanNoInt;
    private javax.swing.JTextField textId;
    private javax.swing.JTextField txtApMaterno;
    private javax.swing.JTextField txtApPaterno;
    private javax.swing.JTextField txtCalle;
    private javax.swing.JTextField txtCodPostal;
    private javax.swing.JTextField txtColonia;
    private javax.swing.JTextField txtDelegacion;
    private javax.swing.JTextField txtEmail;
    private javax.swing.JTextField txtEstado;
    private javax.swing.JTextField txtLada;
    private javax.swing.JTextField txtNomUsu;
    private javax.swing.JTextField txtNombre;
    private javax.swing.JTextField txtNumExt;
    private javax.swing.JTextField txtNumInt;
    private javax.swing.JTextField txtPais;
    private javax.swing.JPasswordField txtPassword;
    private javax.swing.JTextField txtRfc;
    private javax.swing.JTextField txtTelefono;
    // End of variables declaration//GEN-END:variables

}
